﻿using System.Collections.Generic;
using System.Data.Entity;
using CH.FourBoards.LagerWalti.Persistence.Setup.Creation;
using CH.FourBoards.LagerWalti.Persistence.Setup.FixedData;

namespace CH.FourBoards.LagerWalti.Persistence.Testing
{
    public class TestSetup
    {
        public void Execute()
        {
            using (var dbContext = new DataContext()) {
                //Database.SetInitializer(new DropCreateSeedDatabaseAlways(TestDataGenerators));
                Database.SetInitializer(new RecreateIfObsolete(TestDataGenerators));

                // set to false to ensure that different test suites do not interfere with each other
                dbContext.Database.Initialize(false);

            }
        }

        private IList<IDataGenerator> TestDataGenerators
        {
            get
            {
                var ret = new List<IDataGenerator>
				{
					new MasterDataGenerator(),
					new SampleDataGenerator()
				};
                return ret;
            }
        }

    }
}
